import {Component, OnDestroy, OnInit, ViewEncapsulation} from '@angular/core';
import * as global from '../../../core/globals/globals.service';
@Component({
  selector: 'seed-advertisement',
  templateUrl: './advertisement.component.html',
  styleUrls: ['./advertisement.component.scss'],
  encapsulation: ViewEncapsulation.None
})
export class AdvertisementComponent implements OnInit, OnDestroy {
  public subscription: any;
  public isVisible: boolean;
  public advertisementUrl: string = global.advertisementUrl;

  constructor() {
    this.subscription = global.isVisibleForAdvertisement.subscribe(value => {
      this.isVisible = value;
    });
  }

  onClose() {
    global.isVisibleForAdvertisement.next(false);
  }

  ngOnInit() {
  }

  ngOnDestroy() {
    this.subscription.unsubscribe();
  }

}
